<template>
  <view class="index">
    <!-- <nut-watermark :z-index="999" :content="userInfo.c_user_name"></nut-watermark> -->
    <view class="userInfo">
      <view class='avater'></view>
      <view class="info">
        <view class="area">{{userInfo.c_contacts_area}}</view>
        <view class="phone">{{userInfo.c_contacts_phone}}</view>
      </view>
    </view>
    <nut-cell-group title="" desc="">
      
      <nut-cell v-for="item in navList" :title="item.m_name" is-link  @click="gotoPage(item.m_url)">
        <template #icon>
          <IconFont font-class-name="iconfont" class-prefix="icon" size="15" :name="item.icon" />
        </template>
      </nut-cell>
      <!-- <nut-cell title="机柜设备" is-link @click="gotoPage('/pages/cabinet/index')">
        <template #icon>
          <IconFont font-class-name="iconfont" class-prefix="icon" size="15" name="jiguizongshu" />
        </template>
      </nut-cell>
      <nut-cell title="离线设备" is-link @click="gotoPage('/pages/offlineCabinet/index')">
        <template #icon>
          <IconFont font-class-name="iconfont" class-prefix="icon" size="15" name="lixianshebei" />
          
        </template>
      </nut-cell> 
      <nut-cell title="眼镜上新" is-link @click="gotoPage('/pages/glass/index')">
        <template #icon>
          <IconFont font-class-name="iconfont" class-prefix="icon" size="15" name="ziyuan" />
        </template>
      </nut-cell> -->
      <!-- <nut-cell title="财务分析" is-link @click="gotoPage('/pages/money/index')">
        <template #icon>
          <IconFont font-class-name="iconfont" class-prefix="icon" size="15" name="caiwu" />
        </template>
      </nut-cell> -->
      <nut-cell title="设置" is-link @click="gotoPage('/pages/setting/index')">
        <template #icon>
          <IconFont font-class-name="iconfont" class-prefix="icon" size="15" name="shezhi" />
        </template>
      </nut-cell>
    </nut-cell-group>
  </view>
</template>

<script setup>
import './index.scss';
import { ref } from 'vue';
import { IconFont } from '@nutui/icons-vue-taro'
import { My } from '@nutui/icons-vue-taro'
import Taro, {useDidShow} from '@tarojs/taro'
const userInfo = ref({})
const navList = ref([])

const gotoPage = (path) => {
  Taro.navigateTo({
    url: path
  })
}
useDidShow(() => {
  Taro.hideHomeButton()
  var userInfoSync = Taro.getStorageSync('userInfo')
  if(!userInfoSync) {
    Taro.reLaunch({
      url: '/pages/login/index'
    })
    return
  }
  userInfo.value = userInfoSync ? JSON.parse(userInfoSync) : {}

  navList.value = userInfo.value.module_list
  console.log(navList.value)
})
</script>

<style>
</style>